//
//  GKPresentController.m
//  GKTranstionAnimation
//
//  Created by Apple on 16/11/16.
//  Copyright © 2016年 郭凯. All rights reserved.
//

#import "GKPresentController.h"
#import "GKDissmissController.h"
#import "GKInteractiveTransitionTool.h"

@interface GKPresentController ()
@property(nonatomic,strong)GKInteractiveTransitionTool *presentInteractiveTransitionTool;
@end

@implementation GKPresentController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTitle:@"点我呀美女" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    button.autoresizingMask = UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin;
    [button addTarget:self action:@selector(present) forControlEvents:UIControlEventTouchUpInside];
    [button sizeToFit];
    button.center = self.view.center;
    [self.view addSubview:button];
    
    /**重点*/
    GKInteractiveTransitionTool *presentInteractiveTransitionTool = [[GKInteractiveTransitionTool alloc]initWithTransitionType:InteractiveTransitionTypePresent GestureDirection:InteractiveTransitionGestureDirectionUp];
    [presentInteractiveTransitionTool addPanGestureForViewController:self.navigationController];
    self.presentInteractiveTransitionTool = presentInteractiveTransitionTool;
    __weak typeof(self) weakself = self;
    [presentInteractiveTransitionTool setPresentConifg:^{
        [weakself present];
    }];
    
}



-(void)present{
    GKDissmissController *dissVc = [[GKDissmissController alloc]init];
    dissVc.presentInteractiveTransitionTool = _presentInteractiveTransitionTool;
    [self presentViewController:dissVc animated:YES completion:nil];
}

-(void)dealloc{
    NSLog(@"%s",__func__);
}
@end
